package com.hopu.oa.dao.process;

import com.hopu.oa.entity.management.AoaTypeList;
import com.hopu.oa.entity.process.*;
import com.hopu.oa.entity.user.AoaUser;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * 费用报销表
 */
@Repository
@Mapper
public interface BursementDao {

    AoaBursement selectAllBursement(@Param("processId") Integer processId);

    @Select("select * from aoa_type_list")
    List<AoaTypeList> selectTypeList();


    @Select("select * from aoa_user where user_id = #{userId}")
    AoaUser selectByProcessUserIdAfter(Integer userId);

    @Select("select * from  aoa_type_list where type_id = #{typeId}")
    AoaTypeList selectByTypeId(Integer typeId);

    @Select("select * from aoa_detailsburse where bursment_id = #{BursementId}")
    List<AoaDetailsburse> selectByBursementIdAfter(Integer BursementId);

    AoaEvection selectEvectionByProcessId(@Param("processId") Integer processId);

    AoaEvectionmoney selectEvectionmoneyByProcessId(@Param("processId") Integer processId);

    List<AoaStay> selectStayByEvectionmoneyId(@Param("EvectionmoneyId") Integer EvectionmoneyId);

    List<AoaTraffic> selectTrafficBy(@Param("EvectionmoneyId") Integer EvectionmoneyId);

    AoaResign selectResignByByProcessId(@Param("processId") Integer processId);


    //我的申请分页模糊搜素
    List<AoaProcessList> selectAll(@Param("userId") Integer userId, String baseKey, @Param("index") Integer index, @Param("size") Integer size);

    //根据id查询全部
    AoaProcessList selectById(Integer id);

    //查询请假天数和请假类型
    AoaHoliday selectByProID(Integer id);

    // 查询经理意见和人事意见
    @Select("select * from aoa_holiday ah where ah.pro_id=#{proId}")
    AoaHoliday selectByID(Integer proId);

    //查询加班类型和加班时间
    AoaOvertime selectOverAndTypeById(Integer prcId);

    @Select("select * from aoa_overtime ao where ao.pro_id=#{proId}")
    AoaOvertime selectByProId(Integer proId);

    AoaRegular selectRegularByProcessId(@Param("processId") Integer processId);

    //    图片预览
    @Select("select * from aoa_attachment_list where attachment_id = #{id}")
    AoaAttachmentList selectAoaAttachmentList(Integer id);

    //经理意见
    //费用报销
    @Update("update aoa_bursement set manager_advice = #{managerAdvice} where pro_id = #{proId}")
    int ManagerAdviceBursement(@Param("proId") Integer proId, @Param("managerAdvice") String managerAdvice);

    //加班申请
    @Update("update aoa_overtime set manager_advice = #{managerAdvice} where pro_id = #{proId}")
    int ManagerAdviceOvertime(@Param("proId") Integer proId, @Param("managerAdvice") String managerAdvice);

    //出差申请
    @Update("update aoa_evection set manager_advice = #{managerAdvice} where pro_id = #{proId}")
    int ManagerAdviceEvection(@Param("proId") Integer proId, @Param("managerAdvice") String managerAdvice);

    //离职
    @Update("update aoa_resign set manager_advice = #{managerAdvice} where pro_id = #{proId}")
    int ManagerAdviceResign(@Param("proId") Integer proId, @Param("managerAdvice") String managerAdvice);

    //转正
    @Update("update aoa_regular set manager_advice = #{managerAdvice} where pro_id = #{proId}")
    int ManagerAdviceRegular(@Param("proId") Integer proId, @Param("managerAdvice") String managerAdvice);

    //请假
    @Update("update aoa_holiday set manager_advice = #{managerAdvice} where pro_id = #{proId}")
    int ManagerAdviceHoliday(@Param("proId") Integer proId, @Param("managerAdvice") String managerAdvice);

    //出差费用
    @Update("update aoa_evectionmoney set manager_advice = #{managerAdvice} where pro_id = #{proId}")
    int ManagerAdviceEvectionMoney(@Param("proId") Integer proId, @Param("managerAdvice") String managerAdvice);


    //财务部经理意见
    //费用报销
    @Update("update aoa_bursement set financial_advice = #{financialAdvice} where pro_id = #{proId}")
    int FinancialAdviceBursement(@Param("proId") Integer proId, @Param("financialAdvice") String financialAdvice);

    //离职申请
    @Update("update aoa_resign set financial_advice = #{financialAdvice} where pro_id = #{proId}")
    int FinancialAdviceResign(@Param("proId") Integer proId, @Param("financialAdvice") String financialAdvice);

    //出差费用
    @Update("update aoa_evectionmoney set financial_advice = #{financialAdvice} where pro_id = #{proId}")
    int FinancialAdviceEvectionMoney(@Param("proId") Integer proId, @Param("financialAdvice") String financialAdvice);


    //人事部经理意见
    //加班申请
    @Update("update aoa_overtime set personnel_advice = #{personnelAdvice} where pro_id = #{proId}")
    int personneAdviceOvertime(@Param("proId") Integer proId, @Param("personnelAdvice") String personnelAdvice);

    //出差申请
    @Update("update aoa_evection set personnel_advice = #{personnelAdvice} where pro_id = #{proId}")
    int personneAdviceEvection(@Param("proId") Integer proId, @Param("personnelAdvice") String personnelAdvice);

    //离职申请
    @Update("update aoa_resign set personnel_advice = #{personnelAdvice} where pro_id = #{proId}")
    int personneAdviceResign(@Param("proId") Integer proId, @Param("personnelAdvice") String personnelAdvice);

    //转正
    @Update("update aoa_regular set personnel_advice = #{personnelAdvice} where pro_id = #{proId}")
    int personneAdviceRegular(@Param("proId") Integer proId, @Param("personnelAdvice") String personnelAdvice);

    //请假
    @Update("update aoa_holiday set personnel_advice = #{personnelAdvice} where pro_id = #{proId}")
    int personneAdviceHoliday(@Param("proId") Integer proId, @Param("personnelAdvice") String personnelAdvice);


    //研发部经理意见
    //市场部经理意见
    //人事部经理意见
}
